Repository navigation
feat(agents): execute 工具调用单独带命令行 command - #246
Merged
Merged
Conversation
toolCall 事件新增可选 command(1 字节到 1 MiB),title 写命令要做什么; Core 在 didStart 和记录分页读取里发 toolCommands: true,后端看到才发送, 旧 Core 严格解码不受影响。四语 SDK 的 AgentSessionStart 新增 toolCommands, 契约 README、样例和协议更新记录同步。
xiaoyumuxi
marked this pull request as ready for review
December 1, 2026 14:02
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 2 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
桌面端 Agent 对话照 Antigravity 重做工具调用(Lithe-IDEA Issue #2599、Draft #2600):命令步骤的标题显示“已运行 <这条命令要做什么>”,展开后的命令卡片里才显示命令本身。现在
toolCall只有一个title,Claude Code 插件只能把它写成Bash(ls -la),宿主拿不到“描述”和“命令”两样东西。这个 PR 给execute调用加一个可选的command字段。改动
toolCall事件新增可选command:execute调用实际运行的命令行(1 字节到 1 MiB,不能为空)。这时title写这条命令要做什么,例如 CLI 给的描述。没有command时宿主照旧只用标题。didStart新增toolCommands: true:旧 Core 的ToolCallEvent用deny_unknown_fields严格解码,收到command会以 -32602 拒绝整批报告。所以 Core 在didStart里声明自己接受这个字段,后端只在看到它时才发送。read函数新增可选请求参数toolCommands,agentSessions.page和toolCalls一起发送。只有这时tool消息才可以带command,否则(包括旧的agentSessions.read)以agentSessions.invalidRead拒绝。AgentSessionStart都新增toolCommands(Rusttool_commands、GoToolCommands、JavatoolCommands()、NodetoolCommands),类型、README 和测试同步。记录读取仍是普通 JSON 函数,不需要改 SDK。toolCall行、记录读取一节)、fixtures/agents/native-session.json(agent-2 的didStart带toolCommands,所有 start 记录都写明取值)、fixtures/agents/record-read.json(withIDs请求带toolCommands,结果多一条带command的execute调用)、协议更新记录同步更新。都是
agents0 内的补充,不升能力版本,没有新增宿主方法、通知或错误码。agents/report(toolCall新增command)execute调用单独带命令行,title写它要做什么agents/didStart(通知,新增toolCommands)command,后端据此决定是否发送验证
cargo test -p lithe-agent-runtime(48 个):didStart带toolCommands;实时toolCall带command原样到达事件,空command被拒绝;记录分页请求带toolCommands,带command的调用原样返回,空command、非tool角色上的command被拒绝;旧agentSessions.read遇到command被拒绝;契约样例与运行时一致。cargo fmt --all -- --check、cargo clippy -p lithe-agent-runtime --all-targets -- -D warningscargo test --test agents、Gogo test ./lithe/、Nodenpm test+npm run test:types、Javamvn -pl plugin-sdk test -Dtest=AgentsTestnode shared/plugins/scripts/verify-docs.mjs、node shared/plugins/scripts/sdk-e2e.mjs后续
toolCommands时发送command,另开 PR。